package fmanganiello.tests.javatests.depinj.creditcard.fake;

import fmanganiello.tests.javatests.depinj.billing.ChargeResult;
import fmanganiello.tests.javatests.depinj.creditcard.CreditCard;
import fmanganiello.tests.javatests.depinj.creditcard.CreditCardProcessor;
import fmanganiello.tests.javatests.depinj.creditcard.CreditCard.ChargeError;

public class FakeCreditCardProcessor implements CreditCardProcessor {
	public ChargeResult charge(CreditCard card, double amount) {
		ChargeError chargeStatus = card.canChargeSum(amount);
		return chargeStatus == ChargeError.OK ?
				new ChargeResult() :
				new ChargeResult(false, chargeStatus.toString());
	}
}
